{include file="Public/header"}
<style>
    *{
        margin:0;
        padding:0;
    }
    body{
        background: #ffffff;
    }
    .star{
        font-size: 30px;
    }
</style>
<table class="am-table am-table-striped am-table-hover table-main">
  <tr>
      <th width="30"></th>
      <th width="120">{:lang('label')['orderid']}</th>
      <th width="30">{:lang('label')['price']}</th>
      <th width="100">类型</th>
      <th width="50">{:lang('label')['status']}</th>
      <th width="200">{:lang('label')['remark']}</th>
      <th width="100">发单{:lang('label')['time']}
          <div style="float: right;margin-right: 10px;font-size: 13px" onclick="refrush()" title="刷新">
              <!--<span id="number" style="color: red">30</span>-->
              <i id="refrush" style="color: red" class="am-icon-refresh"></i>
          </div>
      </th>
  </tr>
  {volist name="data" id="order"}
  <tr class="order_tr" id="{$order.order_id}">
      <td style="padding: 0;text-align: center"><span style="color: red;display: none" class="star">⭐</span></td>
      <td style="line-height:30px">{$order.order_id}</td>
      <td style="line-height:30px">￥{$order.price}</td>
      <td style="line-height:30px">{if $order.type == 'call_the_car'}叫个车{elseif $order.type == 'book_a_room'}订个房{elseif $order.type == 'user_pin_car'}拼个车{else}跑个腿{/if}</td>
      <td style="line-height:30px">{if $order.status =="1"}<span class="text-red">{:lang('label')['order_status_1']}</span>{else}<span class="text-sub">{:lang('label')['order_status_'.$order.status]}</span>{/if}</td>
      <td style="line-height:30px">{$order.remark}</td>
      <td style="line-height:30px">{$order.require_time|date="Y-m-d H:i:s",###}</td>
  </tr>
  {/volist}
</table>
{include file="public/pages" /}
{php}$old_data = count($data);{/php}
<script>
    var old_data = "{$old_data}";
    function update_order(){
        $.post("__URL__/socket?type=order&aid={:input('get.aid')}",{},function(data){
            if(data> old_data){
                layer.msg('订单列表发生变化！');
                refrush();
            }
        });
    }

    function auto(){
        update_order();
        setTimeout(function (){
            auto();
        },8000);
    }
    auto();
    
    function refrush() {
        $("#refrush").attr('class','am-icon-refresh am-icon-spin');
        parent.$("#audio").attr('src','/music.mp3');
        parent.document.getElementById('audio').play();
        setTimeout(function(){
            window.location.reload();
        },10000);
    }
    
    $(".order_tr").click(function (){
        parent.order_id = this.id;
        var express_id = parent.express_id;
        parent.$("#iframe").attr("src",'__URL__/dispatch?order_id='+this.id+'&express_id='+express_id);
        $(".order_tr").find('.star').css('display','none');
        $(this).find('.star').css('display','');
    });
</script>
{include file="Public/footer"}